//
//  LeGameObject.h
//  Leste
//
//  Created by 王乐 on 2022/1/24.
//

#ifndef LeGameObject_hpp
#define LeGameObject_hpp

#include <string>
#include "LeTransform.h"

class LeRenderer;
class LeBehaviour;
class LeRigidBody;
class LeParticleSystem;

class LeGameObject
{
public:
    LeGameObject();
    virtual ~LeGameObject();
    
public:
    virtual void Initialize() = 0;
    
    void Awake();       // Before gameloop, right after GameOjbect initialized.
    void PreRender();   // Before gameLoop.
    void Start();       // Before gameloop.
    void RenderSelection(); // In GameLoop.
    void Update();      // In gameloop.
    void PostWorldStep();//In gameloop.
    void FixedUpdate(); // In gameloop.
    void Render();      // In gameloop.
    void PostRender();  // After gameloop.

    void PostprocessingSetup();
    void PostprocessingRender();

    void OnContactBegin(LeGameObject* pOther);
    void OnContactEnd(LeGameObject* pOther);

    void DestroyGameObject();
    void DestroyRigidBodyInWorld();

    bool isActive() const;
    void setActive(bool isActive);
    
protected:
    void initComponents(LeRenderer* pRenderer, LeRigidBody* pRigidBody, LeBehaviour* pBehaviour, LeParticleSystem* pParticleSystem);


public:
    std::string strName;
    unsigned int ID;
    bool m_bIsActive;
    bool m_bSelectable;
    
    // Components
    LeTransform m_Transform;
    LeRenderer* m_pRenderer;
    LeRigidBody* m_pRigidBody;
    LeBehaviour* m_pBehaviour;
    LeParticleSystem* m_pParticleSystem;
};

#endif /* LeGameObject_hpp */
